import router from './router'
import store from './store'
import NProgress from 'nprogress' // Progress 进度条
import 'nprogress/nprogress.css'// Progress 进度条样式
router.beforeEach((to, from, next) => {
  // next()
  NProgress.start();
    store.dispatch('GetInfo').then(res => {
      if ((roleMenuCodes && roleMenuCodes.indexOf(to.name) == -1) && !to.meta.hidden && to.name != 'home') { //路由无权限直接访问首页
        next({path: '/home'})
      } else {
        next()
      }
    })
});


router.afterEach(() => {
  NProgress.done() // 结束Progress
});


